package com.study.blog.controller;

import com.study.blog.service.TagService;
import com.study.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 1
 * @data 2022/2/15
 */
@RestController
@RequestMapping("tags")
public class TagsController {

    @Autowired
    private TagService tagService;

    @GetMapping("hot")
    public Result hot(){
        int limit = 3;
        return tagService.hot(limit);
    }

    @GetMapping
    public Result findAll(){
        return tagService.findAll();
    }

    @GetMapping("detail")
    public Result detail(){
        return tagService.detail();
    }

    @GetMapping("detail/{id}")
    public Result TagDetail(@PathVariable("id") Long id){

        return tagService.TagDetail(id);
    }
}
